<html>
<head><meta charset="utf-8"><title>Idea: Move away from the term &quot;user defined type&quot; · t-lang/doc · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/index.html">t-lang/doc</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html">Idea: Move away from the term &quot;user defined type&quot;</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="230207318"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230207318" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230207318">(Mar 14 2021 at 02:57)</a>:</h4>
<p>Hello, I think the term "user-defined type" (= struct + enum + union) doesn't look very good, because it's hard to define what is "user" here (are types in <code>std</code> user defined types? specially, is <code>Box&lt;T&gt;</code> a user defined type?). In compiler this is called Adt. I do think we should move away from this term.</p>



<a name="230207600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230207600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230207600">(Mar 14 2021 at 03:02)</a>:</h4>
<p>is there an example of it being used which results in confusion?</p>



<a name="230207634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230207634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230207634">(Mar 14 2021 at 03:03)</a>:</h4>
<p>I think <code>specified type</code> is generally better overall</p>



<a name="230207638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230207638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Connor Horman <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230207638">(Mar 14 2021 at 03:03)</a>:</h4>
<p>I believe C++'s standard also uses the term "user-defined type" for structs, enums, and unions. It also confusingly uses a similar but different term, "user-provided types", for types that are "truely" defined by the user, IE. not ones provided by the C++ Standard Library. (IE. it's prior art  for the term, but it's not necessarily the best example).</p>



<a name="230207696"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230207696" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230207696">(Mar 14 2021 at 03:04)</a>:</h4>
<p>in Rust at least a <code>Vec</code> is also a user-defined type fwiw</p>



<a name="230207736"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230207736" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230207736">(Mar 14 2021 at 03:05)</a>:</h4>
<p>as opposed to a built-in types which are primitives</p>



<a name="230207824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230207824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230207824">(Mar 14 2021 at 03:07)</a>:</h4>
<p><code>Box&lt;T&gt;</code> I would describe as a generic data type</p>



<a name="230220580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230220580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> isHavvy <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230220580">(Mar 14 2021 at 07:36)</a>:</h4>
<p>I don't like the term, even if C++ uses it; It's used because I asked what we should call them and that's the answer I was given.</p>



<a name="230257175"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230257175" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230257175">(Mar 14 2021 at 17:50)</a>:</h4>
<p>What about "composite types" or "nominal types" or something? (I'm not good at naming things in English as it's not my mother tongue)</p>



<a name="230257285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230257285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230257285">(Mar 14 2021 at 17:52)</a>:</h4>
<p>Are type aliases nominal types?</p>



<a name="230257291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230257291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230257291">(Mar 14 2021 at 17:52)</a>:</h4>
<p>'lew types'? <span aria-label="wink" class="emoji emoji-1f609" role="img" title="wink">:wink:</span></p>



<a name="230257295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230257295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230257295">(Mar 14 2021 at 17:52)</a>:</h4>
<p>The reference inconsistently uses all three terms (user-defined, nominal, and composite).  </p>
<p>I find the definition in the glossary for "nominal type" isn't great. </p>
<p><code>Types that can be referred to by a path directly. Specifically [enums], [structs], [unions], and [trait objects].</code></p>
<p>But built-in types are also referenced by path.</p>



<a name="230257330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230257330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230257330">(Mar 14 2021 at 17:53)</a>:</h4>
<p>wait, trait objects can be referred to by a path?</p>



<a name="230257401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230257401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230257401">(Mar 14 2021 at 17:54)</a>:</h4>
<p>I guess that makes a bit more sense if you use bare trait objects</p>



<a name="230257402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230257402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230257402">(Mar 14 2021 at 17:54)</a>:</h4>
<p><code>path::to::MyTrait</code></p>



<a name="230257438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230257438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230257438">(Mar 14 2021 at 17:55)</a>:</h4>
<p>with the <code>dyn</code> it looks like a primitive, like <code>*const T</code> (which I guess is not a nominal type by this definition)</p>



<a name="230257515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230257515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230257515">(Mar 14 2021 at 17:56)</a>:</h4>
<p>I was trying to write a slide for a simple overview of all kinds of types in rust. Here's my a little inaccurate summary<br>
of what i learnt from Rust Reference:</p>



<a name="230257518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230257518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230257518">(Mar 14 2021 at 17:56)</a>:</h4>
<p><a href="/user_uploads/4715/pM45mjtH50ZSfhqF678uNro2/image.png">image.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/pM45mjtH50ZSfhqF678uNro2/image.png" title="image.png"><img src="/user_uploads/4715/pM45mjtH50ZSfhqF678uNro2/image.png"></a></div>



<a name="230257581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230257581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230257581">(Mar 14 2021 at 17:58)</a>:</h4>
<p>these labels aren't mutually exclusive</p>



<a name="230257598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230257598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230257598">(Mar 14 2021 at 17:58)</a>:</h4>
<p>oh are they?</p>



<a name="230257605"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230257605" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230257605">(Mar 14 2021 at 17:58)</a>:</h4>
<p>I wouldn't assume so</p>



<a name="230257618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230257618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230257618">(Mar 14 2021 at 17:59)</a>:</h4>
<p>unless there is indication otherwise which I haven't read [totally possible]</p>



<a name="230257759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230257759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230257759">(Mar 14 2021 at 18:01)</a>:</h4>
<p>for example sequence types are also user-defined types</p>



<a name="230257897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230257897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230257897">(Mar 14 2021 at 18:03)</a>:</h4>
<p>realistically though user-defined types aren't specifically presented in the reference</p>



<a name="230257900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230257900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230257900">(Mar 14 2021 at 18:03)</a>:</h4>
<p>Yea, maybe "user-defined" was a bad label to use in that list.  Nominal is probably better?  Those labels were a pretty arbitrary way of just breaking up a big list.</p>



<a name="230258078"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230258078" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230258078">(Mar 14 2021 at 18:06)</a>:</h4>
<p>I do feel those labels did reveal some commonness of those types... which i why i used red, green, blue to put them into categories.</p>



<a name="230258127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230258127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230258127">(Mar 14 2021 at 18:07)</a>:</h4>
<p>the red categories are built-in as part of the language, the green ones are defined by "side-effect" of items, the blue ones are intentionally defined with a item.</p>



<a name="230258129"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/237824-t-lang/doc/topic/Idea%3A%20Move%20away%20from%20the%20term%20%22user%20defined%20type%22/near/230258129" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/237824-t-lang/doc/topic/Idea.3A.20Move.20away.20from.20the.20term.20.22user.20defined.20type.22.html#230258129">(Mar 14 2021 at 18:07)</a>:</h4>
<p>from the list here: <a href="https://doc.rust-lang.org/reference/types.html">https://doc.rust-lang.org/reference/types.html</a><br>
I might remove the links and include definitions and leave the interpretation to the reader</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>